{%include file="header.html"%}
<style>
input {	width: 200px;}
textarea {	width: 350px;	height: 100px;}
</style>
<body>
<div class="fixed-bar">
  <div class="item-title">
    <h3>编辑商户</h3>
  </div>
</div>
<div class="fixed_bottom">
  <form method="post" action="" enctype="multipart/form-data" id="aspnetForm" name="form1">
    <table style=" width:100%;" cellpadding="0" cellspacing="0" class="table tb-type2">
      <tbody>
        <tr>
          <td class="firtd">所属区域:</td>     
          <td>
          	<select name="r_id" id="r_id">
            {%foreach from=$quyu item=ranks%}
            <option {%if $edit.r_id == $ranks.r_id%} selected="selected" required {%/if%} value="{%$ranks.r_id%}">{%$ranks.r_name%}</option>
            {%/foreach%}
            </select>
          </td>
        </tr>
        <tr>
          <td class="firtd">店铺名称:</td>
          <td>
          	<input type="text" name="shop_name" value="{%$edit.shop_name%}"  placeholder="请输入店铺名称" id='shop_name'{%if $edit.s_id%} disabled="disabled" {%/if%}required>&nbsp;&nbsp;&nbsp;&nbsp;
            <br /><span class="shop_name" class="notice-span" >支持中文、字母、数字的组合,2-20个字符</span> 
          </td>
        </tr>
        <tr>
          <td class="firtd"> 店铺密码:</td>
          <td><input type="password" name="shop_password" value="" maxlength="20" required>
          <br /><span class="notice-span" id="pass">不输或为空,默认密码为123456</span></td>

        </tr>
        <tr>
          <td class="firtd"> 确认密码:</td>
          <td><input type="password" name="repassword" value="" maxlength="20" required><span id="repassword"></span>
          <br/><span class="notice-span" id="repass">二次输入的密码必须一致</span>
          </td>
        </tr>
       
         <tr>
          <td class="firtd"> 营业时间</td>
          <td><input type="text" name="start_time" value="{%$edit.start_time%}" required></td>
        </tr>
        <tr>
          <td class="firtd">商铺地址</td>
          <td><input type="text" name="shop_address" value="{%$edit.shop_address%}"></td>
        </tr>
        <tr>
          <td class="firtd"> 商铺起送价</td>
          <td><input type="text" name="start_price" value="{%$edit.start_price%}" required>&nbsp;&nbsp;&nbsp;&nbsp;<span id="email"></span></td>
        </tr>
        <tr>
          <td class="firtd"> 是否开启</td>
          <td><input style="width:15px" type="radio" name="shop_zt" {%if $edit.shop_zt eq 0%}checked{%/if%} value="0"> 是 &nbsp;&nbsp;&nbsp;&nbsp;
          <input style="width:15px" {%if $edit.shop_zt eq 1%}checked{%/if%} type="radio" name="shop_zt" value="1"> 否
          </td>
        </tr>
        <tr>
          <td class="firtd"> 邮箱</td>
          <td><input type="text" name="shop_email" value="{%$edit.shop_email%}" required>&nbsp;&nbsp;&nbsp;&nbsp;<span id="email"></span></td>
        </tr>
        <tr>
          <td class="firtd"> 电话</td>
          <td><input type="text" name="shop_tel" value="{%$edit.shop_tel%}" required>&nbsp;&nbsp;&nbsp;&nbsp;<span id="email"></span></td>
        </tr>
        <tr>
          <td class="firtd"> 是否默认</td>
          <td><input style="width:15px" type="radio" name="shop_tj" {%if $edit.shop_tj eq 1%}checked{%/if%} value="0"> 是 &nbsp;&nbsp;&nbsp;&nbsp;
          <input style="width:15px" {%if $edit.shop_tj eq 0%}checked{%/if%} type="radio" name="shop_tj" value="1"> 否</td>
        </tr>
        <tr>
          <td class="firtd"> 用户头像</td>
          <td><img width="100" height="100" src="../{%if $edit.shop_img%}{%$edit.shop_img%}{%else%}images/mrimgs.jpg{%/if%}" /><br>
          <br>
          <input type='file' name='shop_img' size='35' />
          <input type='hidden' name='shop_imgyx' value="{%$edit.shop_img%}" size='35' /></td>
        </tr>
        <tr>
          <td class="style1">&nbsp;</td>
          <td>
          	  <input type="hidden" name="act" value="insert">
              <input type="hidden" name="s_id" value="{%$edit.s_id%}">
              <a href="JavaScript:void(0);" class="btn" onclick="reset()"><span>重置</span></a>
              <a href="JavaScript:void(0);" class="btn" onclick="$('#tj').click()"><span>确认提交</span></a>
          </td>
        </tr>
      </tbody>
    </table>
    <input type="reset" id="cz" style="display: none;">
    <input type="submit" id="tj" style="display:none;";>
  </form>
</div>
</body>
<script>
    // 重置方法
    function reset(){
        $('input').val('');
        $('textarea').text('');
    }
	
	//验证密码是否一致
	$("input[name=repassword]").blur(function(){
		$(this).data('type','1');
		val=$("input[name=shop_password]").val();
		vals=$(this).val();
			if(val==vals){
				$(this).next('span').html('正确');
				$(this).next('span').css('color','#90B71B')
				$(this).css('border-color','#ccc');
				$(this).data('type','2');
			}else{
				$(this).next('span').html('两次密码输入不一致');
				$(this).next('span').css('color','#f00')
				$(this).css('border-color','#f00');
			}
	});
  $("#shop_name").blur(function(){
    r_id=$("#r_id").val();
    shop_name= $("#shop_name").val();
    $.post("user_sh.php",{act:'name',r_id:r_id,shop_name:shop_name},function(data){
      if(data=='1'){
          $(".shop_name").css("color","#f00");
          $(".shop_name").html("该区域下商户名称已存在");
          $("input[name=shop_name]").css("border-color","#f00");
          $("#shop_name").focus();
      }else{
          $(".shop_name").css("color","#000");
          $(".shop_name").html("支持中文、字母、数字的组合,2-20个字符");
          $("input[name=shop_name]").css("border-color","#ccc");
      }
   });
  });

</script>
</html>